﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using System.Data;
using System.Text;
using System.Configuration;
using Xiaov.SmartWeb.Application.SupCan;

namespace Xiaov.SmartWeb.Application.TZGC
{
    public partial class GcData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.Append("select a.gcmc,a.gcid,b.xmmc from yt_gcb a,yt_xmb b where a.ssxmbm=b.xmid(+) ");
                if (Request.QueryString["xmgc"].ToString() == "true" && Request.QueryString["xmid"] != "")
                {
                    sbSql.AppendFormat("and a.ssxmbm='{0}'", Request.QueryString["xmid"]);
                }
                else if (Request.QueryString["xmgc"].ToString() == "false")
                {
                    if (Request.QueryString["xmid"] != "")
                    {
                        sbSql.AppendFormat("and (a.ssxmbm<>'{0}' or a.ssxmbm is null) ", Request.QueryString["xmid"]);
                    }
                    if (Request.QueryString["gcmc"] != null && Request.QueryString["gcmc"].ToString() != "")
                    {
                        sbSql.AppendFormat("and a.gcmc like '%{0}%'", Request.QueryString["gcmc"]);
                    }
                    if (Request.QueryString["gczt"] != null && Request.QueryString["gczt"].ToString() != "" && Request.QueryString["gczt"].ToString() != "all")
                    {
                        sbSql.AppendFormat("and a.wczt={0}", Request.QueryString["gczt"].ToString());
                    }
                }
                DataSet ds = Maticsoft.DBUtility.DbHelperOra.Query(sbSql.ToString());
                ConvertToXml.Convert(ds.Tables[0], "gcmc,gcid,xmmc", 0, ds.Tables[0].Rows.Count);
            }
        }
    }
}